/*
 * @(#)AquaPalette.java	0.1 2003. 2. 14.
 * 
 * Copyleft 2002 Wonseok Shin Taeksoo Jung
 * Anyone can get benefits from this.
 */
package cs348a.color;

/**
 * A <code>AquaPalette</code> defines a aqua palette.
 * 
 * @version	0.1
 * @author		Wonseok Shin, Taeksoo Jung
 * @since		0.1
 */
public final class AquaPalette extends BasicPalette {
	/** Singleton instance */
	public static final AquaPalette INSTANCE = getInstance();

	/**
	 * Constructor for <code>AquaPalette</code>.
	 * 
	 * @param reds array of red components
	 * @param greens array of green components
	 * @param blues array of blue components
	 */
	private AquaPalette(byte[] reds, byte[] greens, byte[] blues) {
		super("Aqua", reds, greens, blues);
	}
	
	/**
	 * Creates an instance.
	 * 
	 * @return AquaPalette an instance
	 */
	private static AquaPalette getInstance() {
		// Creates arrays of components.
		byte[] reds = new byte[SIZE];
		byte[] greens = new byte[SIZE];
		byte[] blues = new byte[SIZE];

		// Constructs the components.
		for (int i = 0; i < SIZE; i++) {
			double p = (double) i / SIZE;

			// Sets the red component.
			double f = 	(2 * p - 1.0) * SIZE;
			reds[i] = cutOff(f);
			
			// Sets the green component.
			f = (2 * p - 1.0 / 2.0) * SIZE;
			greens[i] = cutOff(f);
			
			// Sets the blue component.
			f = (2 * p) * SIZE;
			blues[i] = cutOff(f);
		}
		
		return new AquaPalette(reds, greens, blues);
	}
}
